<template>
<login-header>欢迎登录</login-header>
<section class="login-section">
    <div class="wrapper">
      <nav>
        <a href="javascript:;" @click="change('account')" :class="{active:activeName==='account'}">账户登录</a>
        <a href="javascript:;" @click="change('qrcode')" :class="{active:activeName==='qrcode'}">扫码登录</a>
      </nav>
       <!-- 表单 -->
      <LoginForm v-if="activeName==='account'"></LoginForm>
      <!-- 二维码 -->
      <div v-if="activeName==='qrcode'" class="qrcode-box">
        <img src="@/assets/images/qrcode.jpg" alt="">
        <p>打开 <a href="javascript:;">小兔鲜App</a> 扫码登录</p>
      </div>
    </div>
  </section>
<LoginFooter></LoginFooter>
</template>
<script>
import { ref } from 'vue'
// import { Form, Field } from 'vee-validate'
import loginHeader from './components/login-header.vue'
import LoginFooter from './components/login-footer'
import LoginForm from './components/login-form.vue'
import { useStore } from 'vuex'
import { useRoute } from 'vue-router'
export default {
  components: { loginHeader, LoginFooter, LoginForm },
  setup () {
    const store = useStore()
    const route = useRoute()
    const activeName = ref('account')
    const change = (sss) => {
      activeName.value = sss
    }
    store.commit('user/setRedirectUrl', route.query.redirectUrl || '/')
    return { activeName, change }
  }
}
</script>

<style scoped lang="less">
.login-section{
    background: url('../../assets/images/login-bg.png') no-repeat center / cover;;
    height: 488px;
  position: relative;
  .wrapper{
    width: 380px;
    min-height: 400px;
    background-color: #fff;
     position: absolute;
    left: 50%;
    top: 54px;
    transform: translate3d(100px,0,0);
    box-shadow: 0 0 10px rgba(0,0,0,.15);
    nav{
        display: flex;
         height: 55px;
      border-bottom: 1px solid #f5f5f5;
      padding:0 40px;
        text-align: center;
        align-items: center;
        a{
            flex: 1;
             line-height: 1;
        display: inline-block;
        font-size: 18px;
        position: relative;
        &:first-child{
             border-right: 1px solid #f5f5f5;
        }
         &.active{
          color: @xtxColor;
          font-weight: bold;
        }
        }
    }
  }
  .qrcode-box {
  text-align: center;
  padding-top: 40px;
  p {
    margin-top: 20px;
    a {
      color: @xtxColor;
      font-size: 16px;
    }
  }
}
}
</style>
